import { FormProps } from '/@/components/Table';
import { FormSchema } from '/@/components/Form';
import { DataTypeOption, ReadTypeList } from '/@/enums/dateTypeEnum';
//添加属性表单
export const attFromSchemas: FormSchema[] = [
  {
    field: 'id',
    component: 'Input',
    label: 'ID',
    show: false,
  },
  {
    field: 'name',
    component: 'Input',
    label: '属性名称',
    componentProps: {
      placeholder: '',
    },
    colProps: {
      span: 24,
    },
    required: true,
  },
  {
    field: 'data_type',
    component: 'Select',
    label: '数据类型',
    componentProps: {
      options: DataTypeOption,
      placeholder: '',
    },
    colProps: {
      span: 24,
    },
    required: true,
  },
  {
    field: 'address',
    component: 'Input',
    label: '地址',
    componentProps: {
      placeholder: '',
    },
    colProps: {
      span: 24,
    },
    required: true,
  },
  {
    field: 'registers_count',
    component: 'Input',
    label: '开始地址',
    componentProps: {
      placeholder: '',
    },
    colProps: {
      span: 24,
    },
  },

  {
    field: 'tag',
    component: 'Input',
    label: '自编码',
    componentProps: {
      placeholder: '',
    },
    colProps: {
      span: 24,
    },
  },
  {
    field: 'objects_count',
    component: 'Input',
    label: '长度',
    componentProps: {
      placeholder: '',
    },
    colProps: {
      span: 24,
    },
  },
  {
    field: 'operation_value',
    component: 'Input',
    label: '系数',
    componentProps: {
      placeholder: '',
    },
    colProps: {
      span: 24,
    },
  },
  {
    field: 'value_order',
    component: 'Input',
    label: '字节序',
    componentProps: {
      placeholder: '',
    },
    colProps: {
      span: 24,
    },
  },
  {
    field: 'read_write_mod',
    component: 'RadioGroup',
    label: '读写类型',
    componentProps: {
      options: ReadTypeList,
      placeholder: '',
    },
    defaultValue: 1,
    colProps: {
      span: 24,
    },
  },
  {
    field: 'describe',
    component: 'InputTextArea',
    label: '描述',
    componentProps: {
      options: DataTypeOption,
      placeholder: '',
    },
    colProps: {
      span: 24,
    },
  },
];

export const attrFormConfig: Partial<FormProps> = {
  labelWidth: 120,
  schemas: attFromSchemas,
  showActionButtonGroup: false,
};

export const getAttrList = () => {
  const result: any[] = [];
  return result;
};

export const getAttrTableData = () => {
  const result: any[] = [];
  for (let i = 0; i < 6; i++) {
    result.push({
      id: i,
      title: 'Vben Admin',
      description: '基于Vue Next, TypeScript, Ant Design Vue实现的一套完整的企业级后台管理系统',
      datetime: '2020-11-26 17:39',
      extra: '编辑',
      icon: 'logos:vue',
      color: '#1890ff',
      author: 'Vben',
      percent: 20 * (i + 1),
    });
  }
  return result;
};
